package com.hello.system.service.impl;

import java.util.List;
import com.hello.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hello.system.mapper.FriendshipsMapper;
import com.hello.system.domain.Friendships;
import com.hello.system.service.IFriendshipsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 用户好友关系Service业务层处理
 * 
 * @author hello
 * @date 2025-10-29
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class FriendshipsServiceImpl extends ServiceImpl<FriendshipsMapper, Friendships> implements IFriendshipsService 
{
    private final FriendshipsMapper friendshipsMapper;

    /**
     * 查询用户好友关系
     * 
     * @param friendshipId 用户好友关系主键
     * @return 用户好友关系
     */
    @Override
    public Friendships selectFriendshipsByFriendshipId(Long friendshipId)
    {
        return friendshipsMapper.selectFriendshipsByFriendshipId(friendshipId);
    }

    /**
     * 查询用户好友关系列表
     * 
     * @param friendships 用户好友关系
     * @return 用户好友关系
     */
    @Override
    public List<Friendships> selectFriendshipsList(Friendships friendships)
    {
        return friendshipsMapper.selectFriendshipsList(friendships);
    }

    /**
     * 新增用户好友关系
     * 
     * @param friendships 用户好友关系
     * @return 结果
     */
    @Override
    public int insertFriendships(Friendships friendships)
    {
        friendships.setCreateTime(DateUtils.getNowDate());
        return friendshipsMapper.insertFriendships(friendships);
    }

    /**
     * 修改用户好友关系
     * 
     * @param friendships 用户好友关系
     * @return 结果
     */
    @Override
    public int updateFriendships(Friendships friendships)
    {
        friendships.setUpdateTime(DateUtils.getNowDate());
        return friendshipsMapper.updateFriendships(friendships);
    }


    /**
     * 批量删除用户好友关系
     * 
     * @param friendshipIds 需要删除的用户好友关系主键
     * @return 结果
     */
    @Override
    public int deleteFriendshipsByFriendshipIds(Long[] friendshipIds)
    {
        return friendshipsMapper.deleteFriendshipsByFriendshipIds(friendshipIds);
    }

    /**
     * 删除用户好友关系信息
     * 
     * @param friendshipId 用户好友关系主键
     * @return 结果
     */
    @Override
    public int deleteFriendshipsByFriendshipId(Long friendshipId)
    {
        return friendshipsMapper.deleteFriendshipsByFriendshipId(friendshipId);
    }
}
